package com.ymatou.iapi.coupon.testcase;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.coupon.parameter.UserReceivePackageBean;
import com.ymatou.iapi.coupon.parameter.UserReceiveResultInfo;
import com.ymatou.iapi.coupon.parameter.UserReceiveResultList;
import com.ymatou.iapi.coupon.service.UserReceivePackageCall;
import com.ymatou.iapi.couponmanage.parameter.CreateCouponBean;
import com.ymatou.iapi.couponmanage.parameter.SellerCreateBatchBean;
import com.ymatou.iapi.couponmanage.service.CreateCouponCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.CouponCallService;
import com.ymttest.business.service.CouponServiceMCallServiceV2;
import com.ymttest.database.model.couponvirtualrecord;
import com.ymttest.database.model.YmtCoupon;
import com.ymttest.database.model.YmtCouponBatch;
import com.ymttest.database.model.YmtCouponPrivateUserBound;
import com.ymttest.database.model.YmtCouponSetting;
import com.ymttest.database.model.YmtCouponVirtualRelation;
import com.ymttest.database.model.coupon;
import com.ymttest.database.model.couponbatch;
import com.ymttest.database.sqlwapper.couponvirtualrecordWapper;
//import com.ymttest.database.sqlwapper.YmtCouponActivityWapper;
//import com.ymttest.database.sqlwapper.YmtCouponBatchWapper;
//import com.ymttest.database.sqlwapper.YmtCouponPrivateUserBoundWapper;
//import com.ymttest.database.sqlwapper.YmtCouponSettingWapper;
//import com.ymttest.database.sqlwapper.YmtCouponValueWapper;
import com.ymttest.database.sqlwapper.YmtCouponWapper;
import com.ymttest.database.sqlwapper.couponWapper;
import com.ymttest.database.sqlwapper.couponbatchWapper;
import com.ymttest.utils.TestDataManager;

@TestSuite
public class Ts_UserReceivePackage {
	private static UserReceivePackageBean userreceivepackageBean;
	private static UserReceivePackageCall userreceivepackageCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("用户领取礼包用例");
	}

	@Before
	public void caseUp() {
		userreceivepackageBean=new UserReceivePackageBean();
		userreceivepackageCall=new UserReceivePackageCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(userreceivepackageCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_001() {
		Logger.start(true,"用户领取礼包-平台链接-多条");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			// 平台券异步更新该字段，放到Job,后面加上
			//	Thread.sleep(5000);
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {

				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
		
//				Couponbatch setting = new YmtCouponSettingWapper()
//						.selectByiCouponSettingId(batch.getiCouponSettingId()).get(0);
//				settingIdlist.add(setting.getiCouponSettingId());
//				receiveCountlist.add(setting.getiReceiveCount());
			}

			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			verifyReturn(receiveCountlist,batchIdlist);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_019() {
		Logger.start(true,"用户领取礼包-平台链接-多条-一个用户可以领取多次");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			createcouponBean.setPerUserReceiveMaxCount(2);
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			// 平台券异步更新该字段，放到Job,后面加上
			//	Thread.sleep(5000);
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {

				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
		
//				Couponbatch setting = new YmtCouponSettingWapper()
//						.selectByiCouponSettingId(batch.getiCouponSettingId()).get(0);
//				settingIdlist.add(setting.getiCouponSettingId());
//				receiveCountlist.add(setting.getiReceiveCount());
			}

			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			verifyReturn(receiveCountlist,batchIdlist);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})    
	@TestCase
	public void Tc_UserReceivePackage_002() {
		Logger.start(true,"用户领取礼包-平台链接-单条");
		try {
			// 设置三个batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());	
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {
				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}
			
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			// 平台券异步更新该字段，放到Job,后面加上
			//	Thread.sleep(5000);
			verifyReturn(receiveCountlist,batchIdlist);
		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})    
	@TestCase
	public void Tc_UserReceivePackage_020() {
		Logger.start(true,"用户领取礼包-平台链接-单条-一个用户可以领取多次");
		try {
			// 设置三个batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			createcouponBean.setPerUserReceiveMaxCount(2);
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());	
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {
				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}
			
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			// 平台券异步更新该字段，放到Job,后面加上
			//	Thread.sleep(5000);
			verifyReturn(receiveCountlist,batchIdlist);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_003() {
		Logger.start(true,"用户领取礼包-商家-多条");
		try {
			// 设置三个batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();	

			// 商家优惠券
			SellerCreateBatchBean couponBatchBean = couponCallService.setDefaultSellerCreateBatchBean();
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {

				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}
			
			userreceivepackageBean = couponCallService.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			// 平台券异步更新该字段，放到Job,后面加上
			//	Thread.sleep(5000);
			verifyReturn(receiveCountlist,batchIdlist);
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_004() {
		Logger.start(true,"用户领取礼包-商家-单条");
		try {
			// 设置三个batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();	

			// 商家优惠券
			SellerCreateBatchBean couponBatchBean = couponCallService.setDefaultSellerCreateBatchBean();
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {

				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}
			
			userreceivepackageBean = couponCallService.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			// 平台券异步更新该字段，放到Job,后面加上
			//	Thread.sleep(5000);
			verifyReturn(receiveCountlist,batchIdlist);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_005() {
		Logger.start(true,"用户领取礼包-平台链接+商家券");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();

			// 平台优惠券-链接
			CreateCouponBean createcouponBean = couponCallService.setDefaultPlatformCreateCouponBeanForRecieve();		

			// 商家优惠券
			SellerCreateBatchBean couponBatchBean = couponCallService.setDefaultSellerCreateBatchBean();

			
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());	
			batchCodes.add(couponCallService.createPlatformCoupon(createcouponBean).getBatchCode());
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {

				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}
			
			userreceivepackageBean = couponCallService.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			verifyReturn(receiveCountlist,batchIdlist);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_006() {
		Logger.start(false,"反例-请传入用户ID");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();	

			// 商家优惠券
			SellerCreateBatchBean couponBatchBean = couponCallService.setDefaultSellerCreateBatchBean();
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
	
			userreceivepackageBean = couponCallService.setUserReceivePackageBean(batchCodes);
			userreceivepackageBean.setUserId(null);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		

			Logger.verifyEquals("null", userreceivepackageCall.getSellerId(), "验证返回SellerId");
			Logger.verifyEquals("1", userreceivepackageCall.getCode(), "验证返回code");
			Logger.verifyEquals("参数错误|userId:请传入用户ID", userreceivepackageCall.getMessage(), "验证返回Message");
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_007() {
		Logger.start(false,"反例-请传入批次编号");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();

			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		

			Logger.verifyEquals("null", userreceivepackageCall.getSellerId(), "验证返回SellerId");
			Logger.verifyEquals("1", userreceivepackageCall.getCode(), "验证返回code");
			Logger.verifyEquals("参数错误|batchCodes:请传入批次编号", userreceivepackageCall.getMessage(), "验证返回Message");
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_008() {
		Logger.start(false,"反例-请传入批次编号");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			List<String> batchCodes=new ArrayList<>();
			batchCodes.add("1223344");
			batchCodes.add("123344");
			batchCodes.add("1233844");
			batchCodes.add("12233944");
		//	userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageBean.setUserId(1111);
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		

			Logger.verifyEquals("null", userreceivepackageCall.getSellerId(), "验证返回SellerId");
			Logger.verifyEquals("1", userreceivepackageCall.getCode(), "验证返回code");
			Logger.verifyEquals("参数错误|batchCodes:请传入批次编号", userreceivepackageCall.getMessage(), "验证返回Message");
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_009() {
		Logger.start(false,"反例-请传入批次编号");
		try {
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(null);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		

			Logger.verifyEquals("null", userreceivepackageCall.getSellerId(), "验证返回SellerId");
			Logger.verifyEquals("1", userreceivepackageCall.getCode(), "验证返回code");
			Logger.verifyEquals("参数错误|batchCodes:请传入批次编号", userreceivepackageCall.getMessage(), "验证返回Message");
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_010() {
		Logger.start(true,"正例-JIRACONN-806传入虚拟券领取");
		try {

			List<String> batchCodes = new ArrayList<>();
			
			CouponCallService couponCallServcie = new CouponCallService();
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());	
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {

				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}
			
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			Map<String, String> virtualCouponCodes = new HashMap() ;
			
			String code = TestDataManager.getRandomNum(10);
			virtualCouponCodes.put(createCouponCall.getBatchCode(), code);
			userreceivepackageBean.setVirtualCouponCodes(virtualCouponCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			// 平台券异步更新该字段，放到Job,后面加上
			//	Thread.sleep(5000);
			verifyReturn(receiveCountlist,batchIdlist);
			
			couponbatch batch = new couponbatchWapper().selectBybatchCode(createCouponCall.getBatchCode()).get(0);
			List<coupon> coupon = new couponWapper().selectByBatchIdAndUserId(batch.getBatchId(), userreceivepackageBean.getUserId());
			
			// 验证Ymt_CouponVirtualRelation表
			List<couponvirtualrecord> couponVirtualRelations = new couponvirtualrecordWapper().selectcouponvirtualrecordByCouponCodeAndVirtualCouponCode(coupon.get(0).getCouponCode(), code);
			Logger.verifyEquals(1, couponVirtualRelations.size(), "验证CouponVirtualRecord生成一条记录");

			if(couponVirtualRelations.size()==1)
			{
				couponvirtualrecord relation = couponVirtualRelations.get(0);
				
				Logger.verifyEquals(false, relation.getIsUsed(), "验证CouponVirtualRecord中IsUsed");
				Logger.verifyEquals(false, relation.getIsCancel(), "验证CouponVirtualRecord中IsCancel");
			}
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	//@Ignore
	public void Tc_UserReceivePackage_011() {
		Logger.start(false,"反例-JIRACONN-806传入虚拟券领取-已领用");
		try {

			List<String> batchCodes = new ArrayList<>();
			//CouponCallService couponCallServcie = new CouponCallService();
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			userreceivepackageBean.setUserId(20238699);
			Map<String, String> virtualCouponCodes = new HashMap() ;
		    
			List<couponvirtualrecord> relations = new couponvirtualrecordWapper().selectTop1couponvirtualrecord();
			//新增
		   if(relations.size()>0){
		    couponvirtualrecord relation=relations.get(0);
			String couponCode = relation.getCouponCode();
			
			int ibatchid=new couponWapper().selectBycouponCode(couponCode).get(0).getBatchId();
			couponbatch batch = new couponbatchWapper().selectByPrimaryKey(ibatchid);
			
	         batchCodes.add(batch.getBatchCode());	
			
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			coupon coupon = new couponWapper().selectBycouponCode(relation.getCouponCode()).get(0);
//			YmtCouponBatch batch = new YmtCouponBatchWapper().selectByPrimaryKey(coupon.getiBatchId());
			
			virtualCouponCodes.put(batch.getBatchCode(), relation.getVirtualCode());
			userreceivepackageBean.setVirtualCouponCodes(virtualCouponCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
		
			Logger.verifyEquals("0", userreceivepackageCall.getCode(), "验证返回errorcode");

			Logger.verifyEquals("操作成功！", userreceivepackageCall.getMessage(), "验证返回errorMessage");

			UserReceiveResultList userReceiveResultList = userreceivepackageCall.getUserReceiveResultList();
			
			List<UserReceiveResultInfo> list = userReceiveResultList.getUserReceiveResultList();
			
			for(int i=0;i<list.size();i++)
			{
				UserReceiveResultInfo item = list.get(i);
				Logger.verifyEquals(userreceivepackageBean.getUserId(), item.getUserId(), "验证返回UserId");
				Logger.verifyEquals(batch.getBatchCode(), item.getBatchCode(), "验证返回BatchCode");
				Logger.verifyEquals(false, item.getIsReceiveSuccess(), "验证返回IsReceiveSuccess");
				Logger.verifyEquals(2, item.getReceiveFailReason(), "验证返回ReceiveFailReason");
			}
		}
		else
		{
			Logger.verifyNotNull(null, "当前数据库虚拟券记录表(CouponVirtualRecord)没有已领用的虚拟券,需创建后再执行此case");	
		}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
//	@Test
//	@Category({P1.class})
//	@TestCase
//	public void Tc_UserReceivePackage_012() {
//		Logger.start(true,"正例-JIRACONN-806传入虚拟券领取-使用后IsUsed=1");
//		try {
//
//			List<String> batchCodes = new ArrayList<>();
//			
//			CouponCallService couponCallServcie = new CouponCallService();
//			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
//			
//			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
//			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
//			
//			batchCodes.add(createCouponCall.getBatchCode());	
//			
//			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
//			Map<String, String> virtualCouponCodes = new HashMap() ;
//			
//			String code = TestDataManager.getRandomNum(10);
//			virtualCouponCodes.put(createCouponCall.getBatchCode(), code);
//			userreceivepackageBean.setVirtualCouponCodes(virtualCouponCodes);
//			
//			userreceivepackageCall.setData(userreceivepackageBean);
//			userreceivepackageCall.callService();		
//			
//			couponbatch batch = new couponbatchWapper().selectBybatchCode(createCouponCall.getBatchCode()).get(0);
//			List<coupon> coupon = new couponWapper().selectByBatchIdAndUserId(batch.getBatchId(), userreceivepackageBean.getUserId());
//		
//			new CouponCallService().useCoupon(userreceivepackageBean.getUserId(), coupon.get(0).getCouponCode());
//			
//			// 验证CouponVirtualRecord表
//			List<CouponVirtualRecord> couponVirtualRelations = new CouponVirtualRecordWapper().selectcouponVirtualRelationsByCouponCodeAndVirtualCouponCode(coupon.get(0).getCouponCode(),code);
//			Logger.verifyEquals(1, couponVirtualRelations.size(), "验证Ymt_CouponVirtualRelation生成一条记录");
//
//			if(couponVirtualRelations.size()==1)
//			{
//				YmtCouponVirtualRelation relation = couponVirtualRelations.get(0);
//				
//				Logger.verifyEquals(true, relation.getIsUsed(), "验证Ymt_CouponVirtualRelation中IsUsed");
//				Logger.verifyEquals(false, relation.getIsCancel(), "验证Ymt_CouponVirtualRelation中IsCancel");
//			}
//					
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_013() {
		//Logger.start(true,"用户领取礼包-平台链接-非链接");
		Logger.start(true,"用户领取礼包-平台优惠券-直接领");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForConversion();

			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());

			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			Logger.verifyEquals("0", userreceivepackageCall.getCode(), "验证返回code");

			Logger.verifyEquals("操作成功！", userreceivepackageCall.getMessage(), "验证返回Message");

			UserReceiveResultList userReceiveResultList = userreceivepackageCall.getUserReceiveResultList();
			
			List<UserReceiveResultInfo> list = userReceiveResultList.getUserReceiveResultList();
			
			List<String> returnbatchCode = new ArrayList<>();
			int num = list.size();
			for(int i=0;i<list.size();i++)
			{
				UserReceiveResultInfo item = list.get(i);
				Logger.verifyEquals(userreceivepackageBean.getUserId(), item.getUserId(), "验证返回UserId");
				returnbatchCode.add(item.getBatchCode());
				Logger.verifyEquals(false, item.getIsReceiveSuccess(), "验证返回IsReceiveSuccess");
				Logger.verifyEquals(19, item.getReceiveFailReason(), "验证返回ReceiveFailReason");
				Logger.verifyEquals("批次不能用于领取", item.getRemark(), "验证返回Remark");

				couponbatch couponBatch = new couponbatchWapper().selectBybatchCode(item.getBatchCode()).get(0);
				
				List<coupon> coupons = new couponWapper()
						.selectByBatchIdAndUserId(Integer.parseInt(couponBatch.getBatchId().toString()), item.getUserId());
				
				 Logger.verifyEquals(0, coupons.size(),
			                "验证YmtCouponPrivateUserBound表没有数据生成");
				 
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_014() {
		Logger.start(false,"用户领取礼包-平台链接-不在领取时间范围");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			Date dNow = new Date(); // 当前时间
	        Date dBefore = new Date();
	        Date dAfter = new Date();

	        Calendar calendar1 = Calendar.getInstance(); // 得到日历
	        calendar1.setTime(dNow);// 把当前时间赋给日历
	        calendar1.add(Calendar.DAY_OF_MONTH, -10); // 设置为前一天
	        dBefore = calendar1.getTime(); // 得到前一天的时间

	        Calendar calendar2 = Calendar.getInstance(); // 得到日历
	        calendar2.setTime(dNow);// 把当前时间赋给日历
	        calendar2.add(Calendar.DAY_OF_MONTH, -1); // 设置为后十天
	        dAfter = calendar2.getTime(); // 得到前一天的时间
	        
			for (String batchCode:batchCodes) {

				new couponbatchWapper().setAcquireStartTime(batchCode, dBefore);
				new couponbatchWapper().setAcquireEndTime(batchCode, dAfter);
			}

			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
		
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			Logger.verifyEquals("0", userreceivepackageCall.getCode(), "验证返回code");

			Logger.verifyEquals("操作成功！", userreceivepackageCall.getMessage(), "验证返回Message");

			UserReceiveResultList userReceiveResultList = userreceivepackageCall.getUserReceiveResultList();
			
			List<UserReceiveResultInfo> list = userReceiveResultList.getUserReceiveResultList();
			
			List<String> returnbatchCode = new ArrayList<>();
			int num = list.size();
			for(int i=0;i<list.size();i++)
			{
				UserReceiveResultInfo item = list.get(i);
				Logger.verifyEquals(userreceivepackageBean.getUserId(), item.getUserId(), "验证返回UserId");
				returnbatchCode.add(item.getBatchCode());
				Logger.verifyEquals(false, item.getIsReceiveSuccess(), "验证返回IsReceiveSuccess");
				Logger.verifyEquals(14, item.getReceiveFailReason(), "验证返回ReceiveFailReason");
				Logger.verifyEquals("超出领取结束时间", item.getRemark(), "验证返回Remark");

				couponbatch couponBatch = new couponbatchWapper().selectBybatchCode(item.getBatchCode()).get(0);
				
				List<coupon> bounds = new couponWapper()
						.selectByBatchIdAndUserId(couponBatch.getBatchId(), item.getUserId());
				
				 Logger.verifyEquals(0, bounds.size(),
			                "验证coupon表没有数据生成");
				 
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_015() {
		Logger.start(false,"用户领取礼包-平台链接-批次不能用于领取");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForConversion();
			
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
		
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
		
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			Logger.verifyEquals("0", userreceivepackageCall.getCode(), "验证返回code");

			Logger.verifyEquals("操作成功！", userreceivepackageCall.getMessage(), "验证返回Message");

			UserReceiveResultList userReceiveResultList = userreceivepackageCall.getUserReceiveResultList();
			
			List<UserReceiveResultInfo> list = userReceiveResultList.getUserReceiveResultList();
			
			List<String> returnbatchCode = new ArrayList<>();
			int num = list.size();
			for(int i=0;i<list.size();i++)
			{
				UserReceiveResultInfo item = list.get(i);
				Logger.verifyEquals(userreceivepackageBean.getUserId(), item.getUserId(), "验证返回UserId");
				returnbatchCode.add(item.getBatchCode());
				Logger.verifyEquals(false, item.getIsReceiveSuccess(), "验证返回IsReceiveSuccess");
				Logger.verifyEquals(19, item.getReceiveFailReason(), "验证返回ReceiveFailReason");
				Logger.verifyEquals("批次不能用于领取", item.getRemark(), "验证返回Remark");

                couponbatch couponBatch = new couponbatchWapper().selectBybatchCode(item.getBatchCode()).get(0);
				
				List<coupon> bounds = new couponWapper()
						.selectByBatchIdAndUserId(couponBatch.getBatchId(), item.getUserId());
				
				 Logger.verifyEquals(0, bounds.size(),
			                "验证coupon表没有数据生成");
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_016() {
		Logger.start(true,"用户领取礼包-平台链接-多条-coupon相对立即生效的优惠券截止时间至23:59:59S-JIRACONN-13324");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			createcouponBean.setEffectiveType(1);
			createcouponBean.setEffectiveValidType(0);
			createcouponBean.setEffectiveDays(1);
			
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {
				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}

			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			verifyReturn(receiveCountlist,batchIdlist);
			
			UserReceiveResultList userReceiveResultList = userreceivepackageCall.getUserReceiveResultList();

			List<UserReceiveResultInfo> list = userReceiveResultList.getUserReceiveResultList();
		
			for(int i=0;i<list.size();i++)
			{
				UserReceiveResultInfo item = list.get(i);				

				coupon coupon = new couponWapper().selectBycouponCode(item.getCouponCode()).get(0);
				
				Date validStart = coupon.getValidStart();
				Calendar calendar1 = Calendar.getInstance(); // 得到日历
				calendar1.setTime(validStart);// 把当前时间赋给日历
				calendar1.add(Calendar.DAY_OF_MONTH, createcouponBean.getEffectiveDays()); // 设置为前一天
				Date validEnd = calendar1.getTime(); // 得到前一天的时间
				
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
				
				Logger.verifyEquals(sdf.format(validEnd).substring(0, 10)+" 23:59:59.000", sdf.format(coupon.getValidEnd()), "验证Coupon表ValidEnd");

			}

			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_017() {
		Logger.start(false,"用户领取礼包-商家-多条-JIRACONN-15533 可以领取买手还未生效的优惠券");
		try {
			// 设置三个batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 couponCallService = new CouponServiceMCallServiceV2();	

			// 商家优惠券
			SellerCreateBatchBean couponBatchBean = couponCallService.setDefaultSellerCreateBatchBean();
			
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();

			Calendar calendar1 = Calendar.getInstance(); // 得到日历
			calendar1.setTime(dNow);// 把当前时间赋给日历
			calendar1.add(Calendar.DAY_OF_MONTH, 1); // 设置为前一天
			dBefore = calendar1.getTime(); // 得到前一天的时间

			couponBatchBean.setEffectiveStartDate(dBefore);
			
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
			batchCodes.add(couponCallService.SellerCreateBatch(couponBatchBean).getBatchCode());
			
			List<Integer> receiveCountlist = new ArrayList<>();
			List<Integer> batchIdlist = new ArrayList<>();

			for (String batchCode:batchCodes) {
				couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);
				batchIdlist.add(batch.getBatchId());
				receiveCountlist.add(batch.getReceivedCount());
			}
			
			userreceivepackageBean = couponCallService.setUserReceivePackageBean(batchCodes);
			
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			verifyReturn(receiveCountlist,batchIdlist);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_UserReceivePackage_018() {
		Logger.start(false,"用户领取礼包-平台链接-JIRACONN-15533 不在领取时间范围");
		try {
			// 设置batchcode
			List<String> batchCodes = new ArrayList<>();
			
			CouponServiceMCallServiceV2 CouponServiceMCallServiceV2 = new CouponServiceMCallServiceV2();
			
			CreateCouponBean createcouponBean = CouponServiceMCallServiceV2.setDefaultPlatformCreateCouponBeanForRecieve();
			
			Date dNow = new Date(); // 当前时间
			Date dBefore = new Date();

			Calendar calendar1 = Calendar.getInstance(); // 得到日历
			calendar1.setTime(dNow);// 把当前时间赋给日历
			calendar1.add(Calendar.DAY_OF_MONTH, 1); // 设置为前一天
			dBefore = calendar1.getTime(); // 得到前一天的时间

			createcouponBean.setAcquireStartTime(dBefore);
			
			CreateCouponCall createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
			
			createCouponCall = CouponServiceMCallServiceV2.createPlatformCoupon(createcouponBean);
			batchCodes.add(createCouponCall.getBatchCode());
		
			userreceivepackageBean = CouponServiceMCallServiceV2.setUserReceivePackageBean(batchCodes);
		
			userreceivepackageCall.setData(userreceivepackageBean);
			userreceivepackageCall.callService();		
			
			Logger.verifyEquals("0", userreceivepackageCall.getCode(), "验证返回code");

			Logger.verifyEquals("操作成功！", userreceivepackageCall.getMessage(), "验证返回Message");

			UserReceiveResultList userReceiveResultList = userreceivepackageCall.getUserReceiveResultList();
			
			List<UserReceiveResultInfo> list = userReceiveResultList.getUserReceiveResultList();
			
			List<String> returnbatchCode = new ArrayList<>();
			int num = list.size();
			for(int i=0;i<list.size();i++)
			{
				UserReceiveResultInfo item = list.get(i);
				Logger.verifyEquals(userreceivepackageBean.getUserId(), item.getUserId(), "验证返回UserId");
				returnbatchCode.add(item.getBatchCode());
				Logger.verifyEquals(false, item.getIsReceiveSuccess(), "验证返回IsReceiveSuccess");
				Logger.verifyEquals(13, item.getReceiveFailReason(), "验证返回ReceiveFailReason");
				Logger.verifyEquals("未到领取开始时间", item.getRemark(), "验证返回Remark");

				  couponbatch couponBatch = new couponbatchWapper().selectBybatchCode(item.getBatchCode()).get(0);
					
					List<coupon> bounds = new couponWapper()
							.selectByBatchIdAndUserId(couponBatch.getBatchId(), item.getUserId());
					
					 Logger.verifyEquals(0, bounds.size(),
				                "验证coupon表没有数据生成");
				 
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	private void verifyReturn(List<Integer> receiveCountlist, List<Integer> batchIdlist) throws JSONException
	{		
		Logger.verifyEquals("0", new JSONObject(userreceivepackageCall.getData()).getString("errorCode"), "验证返回errorCode");

		Logger.verifyEquals("操作成功！", userreceivepackageCall.getMessage(), "验证返回Message");
		
		Logger.verifyEquals("null", new JSONObject(userreceivepackageCall.getReturnData()).getString("exceptionId"), "验证返回exceptionId");
		Logger.verifyEquals("", new JSONObject(userreceivepackageCall.getReturnData()).getString("stackTrace"), "验证返回stackTrace");
		Logger.verifyEquals("0", userreceivepackageCall.getCode(), "验证返回StatusCode");
		Logger.verifyEquals("null", new JSONObject(userreceivepackageCall.getReturnData()).getString("sellerId"), "验证返回sellerId");

		UserReceiveResultList userReceiveResultList = userreceivepackageCall.getUserReceiveResultList();
		
		List<UserReceiveResultInfo> list = userReceiveResultList.getUserReceiveResultList();
		
		List<String> returnbatchCode = new ArrayList<>();
		int num = list.size();
		for(int i=0;i<list.size();i++)
		{
			UserReceiveResultInfo item = list.get(i);
			Logger.verifyEquals(userreceivepackageBean.getUserId(), item.getUserId(), "验证返回UserId");
			returnbatchCode.add(item.getBatchCode());
			Logger.verifyEquals(true, item.getIsReceiveSuccess(), "验证返回IsReceiveSuccess");
			Logger.verifyEquals(0, item.getReceiveFailReason(), "验证返回ReceiveFailReason");
			Logger.verifyEquals("成功", item.getRemark(), "验证返回Remark");

			couponbatch couponBatch = new couponbatchWapper().selectBybatchCode(item.getBatchCode()).get(0);
			coupon coupon=new couponWapper().selectByBatchId(couponBatch.getBatchId()).get(0);
			
			//更改，一个用户的剩余领取数量
			//int remainReceiveTimes = couponBatch.getTotalNum()-couponBatch.getReceivedCount();
			int receiveTimes=new couponWapper().selectByBatchIdAndUserId(couponBatch.getBatchId(), userreceivepackageBean.getUserId()).size();
			int remainReceiveTimes =couponBatch.getReceiveTimesPerUser()-receiveTimes;
			Logger.verifyEquals(true, item.getRemainReceiveTimes()>=0, "验证返回单个用户剩余领取数量大于等于0");
			Logger.verifyEquals(remainReceiveTimes, item.getRemainReceiveTimes(), "验证返回RemainReceiveTimes");
			Logger.verifyEquals(coupon.getCouponCode(), item.getCouponCode(),
		                "验证返回CouponCode");
			Logger.verifyEquals(true, item.getIsReceiveSuccess(),
		                "验证返回IsReceiveSuccess");
			 
			String str=userreceivepackageBean.getBatchCodes()+userreceivepackageBean.getUserId().toString();
			Logger.verifyEquals(true,isContain(item.getCouponCode(),str), "验证返回couponCode中含batchcode+userid字符串");
			Logger.verifyEquals(true,isContain(coupon.getCouponCode(),str), "验证coupon表中couponCode中含batchcode+userid字符串");
		}
		Logger.verifyEquals(true, isListEaqual(returnbatchCode, userreceivepackageBean.getBatchCodes()),
				"验证返回batchcode与传入一致");

		for (int i = 0; i < batchIdlist.size(); i++) {
			couponbatch couponbatch = new couponbatchWapper().selectByPrimaryKey(batchIdlist.get(i));
			Logger.verifyEquals(1, couponbatch.getReceivedCount() - receiveCountlist.get(i),
					"验证返回couponbatch表BatchId=" + batchIdlist.get(i) + "的记录中ReceiveCount多了1");
		}

		for (String batchCode : userreceivepackageBean.getBatchCodes()) {
			couponbatch batch = new couponbatchWapper().selectBybatchCode(batchCode).get(0);

			List<coupon> coupons = new couponWapper()
					.selectByBatchIdAndUserId(batch.getBatchId(), userreceivepackageBean.getUserId());
			Logger.verifyEquals(1, coupons.size(), "验证返回coupon生成一条记录");
		}
	}
	
	private boolean isListEaqual(List<String> list1,List<String> list2)
	{
		for(String str:list1)
		{
			if(!list2.contains(str))
				return false;
		}
		
		for(String str:list2)
		{
			if(!list1.contains(str))
				return false;
		}
		
		return true;
	}
	
	private boolean isContain(String str,String charStr)
	{
		return str.contains(charStr);
	}
}

